package de.lgohlke.helper;

import java.io.IOException;
import java.net.ServerSocket;

/**
 * <p>NetworkHelper class.</p>
 *
 * @author lars
 * @version $Id: $
 */
public final class NetworkHelper
{
  private NetworkHelper()
  {
    // ok
  }

  /**
   * <p>findfreePort.</p>
   *
   * @return a int.
   * @throws java.io.IOException if any.
   */
  public static int findfreePort() throws IOException
  {

    ServerSocket server = new ServerSocket(0);
    int port = server.getLocalPort();
    server.close();

    return port;
  }
}
